<!DOCTYPE html>
<html>
<head th:include="cultivateWeb/header :: culHeaderCss">
</head>
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<link type="text/css" href="/css/cultivateWeb/style/my.css" rel="stylesheet">
<link rel="stylesheet" href="/css/certificateWeb/stationApplyFor/stationApplyFor.css">
<link href="../static/css/bootstrap.min.css" rel="stylesheet">
<body>
<!-- 顶部导航 -->
<header th:include="cultivateWeb/header :: header"></header>
<div style="clear: both"></div>
<div style="background-color: #f7f7f7; ">
    <div class="container">
        <div class="row">
    <div style="height: 40px">
        <p style="line-height: 40px">当前位置：<a href="/cultivate/homepage">首页</a><a href="/cultivate/my"> > 个人资料</a> > 我的简历</p>
    </div>
    <hr style="margin:0 auto"/>
    <section style="background:#F7F7F7;padding: 0">
        <div class="div_2" style="width:100%;margin-top:0">
            <div id="info"></div>
            <div style="display:none;" id="edit"></div>
        </div>
        <div style="clear: both"></div>
    </section>
        </div>
    </div>
    <div style="margin-bottom: 50px;display: inline-block"></div>
</div>
<!-- footer ------------------------------------------------------- -->
<div class="footer" th:include="cultivateWeb/header :: footer"></div>
</body>
<script src="/js/layui/lay/modules/layer.js"></script>
<script type="text/javascript" src="/js/mobile.js"></script>
<script>
    $(function () {
        ajaxToken("/jzApi/recruitment/selResume", "GET", {}, function (res) {
            if (res != null) {
                var info = '';
                var a = '';
                if (res.state == 0) {
                    a = '<span id="yc"><label style="margin-bottom: 10px"><label style="color: #666">（当状态为已上线时，招聘公司可看到您的简历）</label>&nbsp;&nbsp;当前状态：已上线</label><input class="edit" onclick="changeState(\''+ 1+'\',' + '\'' + res.id+ '\');" type="button" value="下线" /></span>'
                } else {
                    a = '<span id="xs"><label style="margin-bottom: 10px"><label style="color: #666">（当状态为已上线时，招聘公司可看到您的简历）</label>&nbsp;&nbsp;当前状态：已隐身</label><input onclick="changeState(\''+ 0 +'\',' + '\'' + res.id+ '\');" class="edit" type="button" value="上线" /></span>';
                }
                var b = '';
                if (res.sex == 0){
                    b = "未知"
                }
                if (res.sex == 1){
                    b = "男"
                }
                if (res.sex == 2){
                    b = "女"
                }
                var d = '';
                if (res.jobNature == 0){
                    d = "全职"
                }
                if (res.jobNature == 1){
                    d = "兼职"
                }
                if (res.jobNature == 2){
                    d = "实习"
                }
                var e = '';
                if (res.applyState == 0){
                    e = "立即到岗"
                }
                if (res.applyState == 1){
                    e = "月内到岗"
                }
                if (res.applyState == 2){
                    e = "考虑机会"
                }
                if (res.applyState == 3){
                    e = "暂不考虑"
                }
                var y = '';
                if (res.isPush == 0){
                    y = "否"
                }
                if (res.isPush == 1){
                    y = "是"
                }
                var c = new Date().getFullYear() - new Date(res.dateOfBirth).getFullYear();
                // console.log("log = " , new Date(res.dateOfBirth).getFullYear());

                //------------------荣获证书---------------------//
                var cer = JSON.parse(res.certificate);
                var rhzs = '';
                if (cer == null){
                    rhzs =  '<div style="margin-top:20px;width: 100%;display:flex;justify-content:space-between">' +
                        '    <span class="jl_zs" style="width:50%"></span>'+
                        '    <span class="jl_date" style="width:50%"></span>'+
                        '</div>';
                }else {
                    cer.forEach(function (item, index) {
                        rhzs +=  '<div style="margin-top:20px;width: 100%;display:flex;justify-content: space-between">' +
                            '    <span class="jl_zs" style="width:50%">'+item.zsName+'</span>'+
                            '    <span class="jl_date" style="width:50%">'+item.zsTime+'</span>'+
                            '</div>';
                    });
                }


                //------------------教育经历---------------------//
                var edu = JSON.parse(res.educationExperience);
                var jyjl = '';
                edu.forEach(function (item, index) {
                    jyjl += '<div style="margin-top:20px">' +
                        '       <span class="jl_sclTime">'+item.rxTime +' - '+item.byTime+'</span>'+
                        '       <span class="jl_school" style="margin:0">'+item.bySchool+'</span>'+
                        '    </div>';
                })

                //------------------工作经历---------------------//
                var work = JSON.parse(res.workExperience);
                var gzjl = '';
                work.forEach(function (item, index) {
                    gzjl +='<div style="margin-top:20px">' +
                        '       <span class="jl_sclYear">'+item.rzTime+' - '+item.lzTime+'</span>'+
                        '       <span class="jl_gs">'+item.gsName+'</span>'+
                        '       <span class="jl_zw">职位：'+item.zwName+' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 薪资：'+item.xsNum+'/月</span>'+
                        '       <span class="jl_ms">'+item.zwDescribe+'</span>'+
                        '   </div>';
                })

                //------------------项目经验---------------------//
                var pro = JSON.parse(res.project);
                var xmjy = '';
                pro.forEach(function (item, index) {
                    xmjy += '<div style="width:100%;margin-top:20px">' +
                        '       <span class="jl_sclYear">'+item.xmStartTime+' - '+ item.xmEndTime +'</span>'+
                        '       <span class="jl_gs">'+item.xmName+'</span>'+
                        '       <span class="jl_ms">'+item.xmDescribe+'</span>'+
                        '   </div>';
                })

                console.log("pro == "  , pro);


                info = '<div style="margin: 25px auto 20px auto">' +
                    '<input type="hidden" value="'+res.state+'" id="state" />' +
                    a +
                    '<span style="float: right;"><a href="/cultivate/editResumes"><input class="edit"  id="bj" type="button" value="编辑" /></a></span>' +
                    '</div>' +
                    '<div style="clear: both; margin-bottom: 20px"></div>' +
                    '<section style="border: 1px #e6e6e6 solid;margin: 0 auto;padding: 10px">' +
                    '<div class="jl_1" style="width:100%">' +
                    '<div class="jl_2" style="width: 100%";>' +
                    '   <span style="display:inline-block"><img src="' + res.headPortrait + '" class="jl_img"></span>' +
                    '   <span class="jl_name" style="margin-right:0">' + res.userName + '</span>'+
                    '   <span class="jl_jb" style="width: 100%;margin:0">'+b+' | '+c+'岁 | '+res.workYears+'年工作经验</span>'+
                    '</div>' +
                    '</div><div style="clear: both"></div>' +
                    '</div>' +
                    '<div class="jl_xx" id="userInfo">' +
                    '   <span class="jl_xx_1">个人信息</span><hr class="jl_hr" />'+
                    '   <div style="margin-top:15px">' +
                    '       <span class="jl_xx_2">联系电话：'+res.mobile+'</span>'+
                    '       <span class="jl_xx_2">个人邮箱：'+res.email+'</span>'+
                    '       <span class="jl_xx_2">出生年月：'+res.dateOfBirth+'</span>'+
                    '       <span class="jl_xx_2">籍&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;贯：' + res.nativePlace+'</span>'+
                    '       <span class="jl_xx_2">毕业学校：' + res.graduatedFrom + '</span>'+
                    '       <span class="jl_xx_2">期望职业：' + res.desiredOccupation + '</span>'+
                    '       <span class="jl_xx_2">期望薪资：' + res.expectedSalary +'</span>'+
                    '       <span class="jl_xx_2">工作性质：' + d+ '</span>'+
                    '       <span class="jl_xx_2">求职状态：' + e+ '</span>'+
                    '       <span class="jl_xx_2">工作地点：' + res.jobAddress+ '</span>'+
                    '       <span class="jl_xx_2">是否推送：' + y + '</span>'+
                    '   </div>'+
                    '</div>'+
                    '<div style="margin-bottom: 70px" id="jy">' +
                    '   <span class="jl_xx_1">教育经历</span><hr class="jl_hr" />'+jyjl+
                    '</div>' +
                    '<div style="margin-bottom: 70px" id="gz">' +
                    '   <span class="jl_xx_1">工作经历</span><hr class="jl_hr" />'+gzjl+

                    '</div>' +
                    '<div style="margin-bottom: 70px" id="xm">' +
                    '   <span class="jl_xx_1">项目经验</span><hr class="jl_hr" />'+xmjy+
                    '</div>' +
                    '<div style="margin-bottom: 70px" id="zs">' +
                    '   <span class="jl_xx_1">荣获证书</span><hr class="jl_hr" />'+rhzs+

                    '</div>' +
                    '<div style="margin-bottom: 70px">' +
                    '   <span class="jl_xx_1">专业技能</span><hr class="jl_hr" />' +
                    '   <div style="margin-top:20px">' +
                    '       <span class="jl_ms">'+res.skills+'</span>'+
                    '   </div>'+
                    '</div>' +
                    '<div style="margin-bottom: 140px">' +
                    '   <span class="jl_xx_1">自我评价</span><hr class="jl_hr" />' +
                    '   <div style="margin-top:20px">' +
                    '       <span class="jl_ms">'+ res.selfEvaluation +'</span>'+
                    '   </div>'+
                    '</div>' +
                    '<div style="clear: both;"></div>' +
                    '</section>';
                $("#info").html(info);

            } else {
                add()
            }


        })
    });




    function changeState(state,id) {
        ajaxToken("/jzApi/recruitment/updChangeState", "GET",
            {
                id: id,
                state:state
            }, function (res) {
                window.location.reload();
            })
    }


    function edit(id) {

        $("#edit").css("display", "block");
        $("#info").css("display", "none");

    }

    function save() {
        var workYears = $("#workYears").val();
        var nativePlace = $("#nativePlace").val();
        var graduatedFrom = $("#graduatedFrom").val();
        var expectedSalary = $("#expectedSalary").val();
        var selfEvaluation = $("#selfEvaluation").val();
        if(workYears=='' || nativePlace==''||graduatedFrom==''||expectedSalary==''||selfEvaluation==''){
            layer.msg("基本信息不能为空");
            return false
        }
        ajaxTokenForm("/jzApi/recruitment/updResume", "POST", {
            id: $("#reId").val(),
            workExperience: $("#workExperience").val(),
            workYears:workYears,
            nativePlace: nativePlace,
            graduatedFrom:graduatedFrom,
            desiredOccupation: $("#desiredOccupation").val(),
            expectedSalary:expectedSalary,
            selfEvaluation:selfEvaluation,
            educationExperience: $("#educationExperience").val()

        }, function () {
            location.href = '/cultivate/myResumes';
        })
    }

</script>
</html>